package com.fengye.modules.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fengye.modules.bo.SysDictTree;
import com.fengye.modules.domain.SysDictModule;
import com.fengye.modules.service.SysDictModuleService;
import com.fengye.modules.mapper.SysDictModuleMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author sky
 * @description 针对表【sys_dict_module】的数据库操作Service实现
 * @createDate 2024-01-20 21:07:53
 */
@Service
public class SysDictModuleServiceImpl extends ServiceImpl<SysDictModuleMapper, SysDictModule>
        implements SysDictModuleService {


    @Override
    public List<SysDictModule> getAllSysDictModule() {

        LambdaQueryWrapper<SysDictModule> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(SysDictModule::getType, "sys_message_module");
        wrapper.orderBy(true, true, SysDictModule::getValue);
        return list(wrapper);
    }


    @Override
    public List<SysDictTree> buildModuleTree() {
        return SysDictTree.build(SysDictTree.convert(getAllSysDictModule()));
    }
}




